<%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8"
         contentType="text/html;charset=utf-8" %>
<%@ include file="/common/taglibs.jsp" %>
<head>
    <title>详细商品添加</title>

</head>
<body>
<div id="wrapper">
    <c:set var="left">product</c:set>
    <%@ include file="/include/left/operation.jsp" %>

    <div id="page-wrapper" class="gray-bg">


        <div class="row wrapper border-bottom white-bg page-heading">
            <div class="col-lg-10">
                <h2>详细商品添加</h2>
                <ol class="breadcrumb">
                    <li>
                        <a href="${ctx}/product/">运营管理</a>
                    </li>
                    <li>
                        <a href="${ctx}/productItem/id=${param.id}">详细商品管理</a>
                    </li>
                    <li class="active">
                        <strong>详细商品添加</strong>
                    </li>
                </ol>
            </div>
        </div>


        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-content">
                            <s:form id="productItemFrom" action="product-item!save.action" class="form-horizontal" method="post" namespace="">
                                <input type="hidden" name="redirect" value="/productItem/?productId=${param.productId}"/>
                                <input type="hidden" name="productItem.product.id" value="${param.productId}"/>

                                <div class="form-group"><label class="col-sm-2 control-label">详细商品标题</label>
                                    <div class="col-sm-6">
                                        <input type="text" name="productItem.title" class="form-control  validate[required]" placeholder="请输入详细商品标题">
                                    </div>
                                </div>

                                <div class="form-group"><label class="col-sm-2 control-label">详细商品价格</label>
                                    <div class="col-sm-6">
                                        <input type="text" name="productItem.price" class="form-control  validate[required,min[0],custom[number]]" placeholder="请输入详细商品价格">
                                    </div>
                                </div>

                                <div class="form-group"><label class="col-sm-2 control-label">详细商品描述</label>
                                    <div class="col-sm-6">
                                        <textarea name="productItem.description" class="form-control  validate[required]" placeholder="请输入详细商品描述"></textarea>
                                    </div>
                                </div>

                                <div class="form-group"><label class="col-sm-2 control-label">主图片</label>
                                    <div class="col-sm-10">
                                        <div class="m-upimgview">
                                            <img  id="preview-img" height="200px;" width="200px;" src="<%=QiniuConfig.NONE_IMG%>!small.jpg">
                                            <input id="upimg" type="hidden" name="productItem.img"
                                                   value="<%=QiniuConfig.NONE_IMG%>">

                                            <input id="fileupload" name="file" class="hidden" type="file"/>

                                            <div class="progress progress-mini">
                                                <div id="progress" style="" class="progress-bar"></div>
                                            </div>
                                        </div>

                                        <a class="btn btn-primary" href="javascript:;" onclick="fileUp('preview-img','upimg','progress','fileupload');">选择一个文件</a>
                                    </div>
                                </div>

                                <div class="hr-line-dashed"></div>
                                <div class="form-group">
                                    <div class="col-sm-4 col-sm-offset-2">
                                        <button class="btn btn-white" type="button"
                                                onclick="javascript:history.back(-1);">取消
                                        </button>
                                        <button class="btn btn-primary" id="submitButton" type="submit" data-loading-text="提交中..." >发布
                                        </button>
                                    </div>
                                </div>
                            </s:form>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <%@ include file="/common/footer.jsp" %>


    </div>

</div>

<%@ include file="/common/scripts.jsp" %>
<%@ include file="/common/validate.jsp" %>
<%@ include file="/common/script/umeditor.jsp" %>
<%@ include file="/common/script/fileupload.jsp" %>


<script>
    $('#productItemFrom').validationEngine({
        promptPosition: 'topLeft',
        onValidationComplete:  function(form, status){//验证回调函数（阻断提交）
            if(status){//当所有验证通过后再执行
                $('#submitButton').button('loading')
                $('#productItemFrom').submit();
            }
        }
    });

    getUMEditor('content');

</script>

</body>

